﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using MDL;

namespace BLL
{
    public class BLL_Products
    {
        /// <summary>
        /// 根据产品类型获取产品信息
        /// </summary>
        /// <param name="Ptid">产品类型ID</param>
        /// <returns>产品信息</returns>
        public static List<Products> GetProducts(int Ptid)
        {
            return DAL_Products.GetProducts(Ptid);
        }
        /// <summary>
        /// 根据简拼获取商品信息
        /// </summary>
        /// <param name="ProductJP">简拼</param>
        /// <returns>商品信息</returns>
        public static List<Products> GetProducts(string ProductJP)
        {
            return DAL_Products.GetProducts(ProductJP);
        }
        /// <summary>
        /// 查询商品信息
        /// </summary>
        /// <param name="ID">根据类型ID</param>
        /// <returns>商品信息</returns>
        public static List<Products> GetProduct(int ID)
        {
            return DAL_Products.GetProduct(ID);
        }
        /// <summary>
        /// 查询是否已有相同的商品信息名称
        /// </summary>
        /// <param name="name">要查询的商品信息名称</param>
        /// <returns>是否有</returns>
        public static List<Products> GetProductName(string name)
        {
            return DAL_Products.GetProductName(name);
        }
        /// <summary>
        /// 增加商品信息
        /// </summary>
        /// <param name="name">商品名称</param>
        /// <param name="ID">商品所属的类型</param>
        /// <param name="Jp">商品简拼</param>
        /// <param name="price">商品价格</param>
        /// <returns>受影响的行数</returns>
        public static int AddProducts(string name, int ID, string Jp, int price)
        {
            return DAL_Products.AddProducts(name, ID, Jp, price);
        }
        /// <summary>
        /// 修改商品信息
        /// </summary>
        /// <param name="name">修改商品名称</param>
        /// <param name="ID">商品所属的类型</param>
        /// <param name="Jp">商品简拼</param>
        /// <param name="price">商品价格</param>
        /// <param name="name1">目标商品名称</param>
        /// <returns>受影响的行数</returns>
        public static int UpdateProducts(string name, int ID, string Jp, int price, string name1)
        {
            return DAL_Products.UpdateProducts(name, ID, Jp, price, name1);
        }
        /// <summary>
        /// 删除商品信息
        /// </summary>
        /// <param name="name">根据商品名称</param>
        /// <returns>受影响的行数</returns>
        public static int DeleteProducts(string name)
        {
            return DAL_Products.DeleteProducts(name);
        }
    }
}
